package com.example.demo.model;

import java.math.BigDecimal;

/**
 * @author linjingze
 * @date 2023/12/15 9:12 下午
 */
public class CustomerRowData implements Comparable<CustomerRowData> {

    private String customerName;


    private String sales;


    private String area = "";
    public BigDecimal volume;
    public BigDecimal allVolume = BigDecimal.ZERO;

    public CustomerRowData(String customerName, String sales, BigDecimal volume) {
        this.customerName = customerName;
        this.sales = sales;
        this.volume = volume;
    }

    public String getArea() {
        return area;
    }

    public CustomerRowData setArea(String area) {
        this.area = area;
        return this;
    }

    public BigDecimal getVolume() {
        return volume;
    }

    public String getCustomerName() {
        return customerName;
    }

    public String getSales() {
        return sales;
    }

    @Override
    public int compareTo(CustomerRowData old) {

        if (allVolume.compareTo(old.allVolume) == 0) {
            if (area.equals(old.area)) {
                return old.volume.compareTo(volume);
            }else{
                return old.area.compareTo(area);
            }
        }else{
            return old.allVolume.compareTo(allVolume);
        }
    }

    public BigDecimal getAllVolume() {
        return allVolume;
    }

    public CustomerRowData setAllVolume(BigDecimal allVolume) {
        this.allVolume = allVolume;
        return this;
    }
}
